from meiduo_admin.mypakge import *
from meiduo_admin.serializers.group_serilziers import *


class CHANNEL___GoodsChannelGroupSerializer(serializers.ModelSerializer):
    class Meta:
        model = GoodsChannelGroup
        fields = [
            'id',
            'name'
        ]


# class CHANNEL___ChannelGroupSerialzier(serializers.ModelSerializer):
#     group = CHANNEL___GoodsChannelGroupSerializer()
#     category = serializers.StringRelatedField()
#
#     class Meta:
#         model = GoodsChannel
#         fields = '__all__'
# 获得频道列表展示序列化
class CHANNEL___ChannelModelSerialzier(serializers.ModelSerializer):
    # group = CHANNEL___GroupMdoeSerializer()
    category = serializers.StringRelatedField()
    group = serializers.StringRelatedField()
    category_id = serializers.IntegerField()
    group_id = serializers.IntegerField()

    class Meta:
        model = GoodsChannel
        fields = [
            'id',
            'category',
            'category_id',
            'group',
            'group_id',
            'sequence',
            'url'
        ]
        # exclude = ['create_time']



class CHANNEL___ChannelTypeSerializer(serializers.ModelSerializer):
    name = serializers.StringRelatedField()
    class Meta:
        model = GoodsChannelGroup
        fields = ['id','name']





